package com.jasony.tools.excel.typehandler;

import org.apache.poi.ss.usermodel.Cell;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;

public class LocalDateTimeTypeHandler implements TypeHandler<LocalDateTime> {

    @Override
    public void write(LocalDateTime source, Cell cell) {
        Date date = Date.from(source.atZone(ZoneId.systemDefault()).toInstant());
        cell.setCellValue(date);
    }
}
